package com.wx.mp.controller;

import com.wx.mp.dao.TCarSubscribeDao;
import com.wx.mp.request.subscribe.oper.CarSubscribeSaveReq;
import com.wx.mp.request.subscribe.query.QuerySubscribeInfosReq;
import com.wx.mp.request.subscribe.query.QuerySubscribeInfosRes;
import com.wx.mp.utils.BizResult;
import com.wx.mp.utils.BizResultVO;
import com.wx.mp.utils.PageBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 提供给管理员使用，需要判断是否已经登陆
 * Copyright: Copyright (c) 2017  zteits
 *
 * @ClassName: TCarSubscribeController.java
 * @Description:
 * @version: v1.0.0
 * Modification History:
 * ---------------------------------------------------------*
 */
@Api(value = "预约车辆", description = "预约车辆")
@RestController
@RequestMapping("/wx/admin/carSubscribe")
public class TCarSubscribeAdminController {

    private static final Logger logger = LoggerFactory.getLogger(TCarSubscribeAdminController.class);
    @Autowired
    private TCarSubscribeDao carSubscribeDao;


    /**
     * 分页查询预约信息.<br/>
     * @param request
     * @return
     */
    @ApiOperation("分页查询预约信息")
    @PostMapping("/querySubscribeInfos")
    public BizResultVO<PageBean<QuerySubscribeInfosRes>> querySubscribeInfos(@RequestBody QuerySubscribeInfosReq request){
        BizResult<PageBean<QuerySubscribeInfosRes>> beanBizResult = carSubscribeDao.querySubscribeInfos(request);
        return new BizResultVO<PageBean<QuerySubscribeInfosRes>>(beanBizResult);
    }

    /**
     * 更改预约订单状态.<br/>
     * @return
     */
    @ApiOperation("更改预约订单状态")
    @PostMapping("/updateSubscribeState")
    public BizResultVO<Boolean> updateSubscribeState(@RequestParam  Long id,@RequestParam Integer subscribeState){
        carSubscribeDao.updateSubscribeState(id,subscribeState);
        return new BizResultVO<Boolean>().setData(true);
    }
}
